//
//  GLUser.swift
//  GitOSC-Swift
//
//  Created by 李萍 on 16/1/4.
//  Copyright © 2016年 李萍. All rights reserved.
//

import Foundation
import SwiftyJSON

class GTUser {
    
    var userID: Int
    var userName: String
    var name: String
    var bio: String
    var weibo: String
    
    var blog: String
    var themeId: Int
    var state: String
    var createdAt: String
    var portrait: String
    
    var email:String
    var private_token:String
    var admin:Bool
    var canCreateGroup:Bool
    var canCreateProject:Bool
    
    var canCreateTeam:Bool
    var followerCount:Int
    var staredCount:Int
    var followingCount:Int
    var watchedCount:Int
    
    init(json:SwiftyJSON.JSON) {
            self.userID = json["id"].intValue
            self.userName = json["username"].stringValue
            self.name = json["name"].stringValue
            self.bio = json["bio"].stringValue
            self.weibo = json["weibo"].stringValue
            
            self.blog = json["blog"].stringValue
            self.themeId = json["theme_id"].intValue
            self.state = json["state"].stringValue
            self.createdAt = json["created_at"].stringValue
            self.portrait = json["portrait"].stringValue
            
            self.email = json["email"].stringValue
            self.private_token = json["private_token"].stringValue
            self.admin = json["is_admin"].boolValue
            self.canCreateGroup = json["can_create_group"].boolValue
            self.canCreateProject = json["can_create_project"].boolValue
            
            self.canCreateTeam = json["can_create_team"].boolValue
            self.followerCount = json["follow"]["followers"].intValue
            self.staredCount = json["follow"]["starred"].intValue
            self.followingCount = json["follow"]["following"].intValue
            self.watchedCount = json["follow"]["watched"].intValue
        
    }
}